package github.sf.mod.calculate;

/**
 * 简易计算器的token
 *
 * @author zhoup
 */
public class Token {
    private TokenType type;
    private String text;
    private int position;
    //操作运算符
    private Op code;

    public Token() {
    }

    public Token(TokenType type, String text, int position) {
        this.type = type;
        this.text = text;
        this.position = position;
    }

    public Token(TokenType type, String text, int position, Op code) {
        this.type = type;
        this.text = text;
        this.position = position;
        this.code = code;
    }

    public TokenType getType() {
        return type;
    }

    public void setType(TokenType type) {
        this.type = type;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public Op getCode() {
        return code;
    }

    public void setCode(Op code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return "Token{" +
                "type=" + type +
                ", text='" + text + '\'' +
                ", position=" + position +
                '}';
    }
}
